use "Piketty.dta", clear
  

 
global controls "Female Immigrant trend i.year"

global FE "i.Country i.yrbrn"



 
quietly: reg Left Bologna $controls $FE  if University==1, vce(cluster Country)
gen sample_m=e(sample)
 

capture erase "T18.tex"

quietly eststo m1: reg Left Bologna if University==1 & short==1 & sample_m==1, vce(cluster Country)
	quietly: sum Left if short==1 & University==1
	estadd scalar ymean = r(mean)

	
quietly eststo m2: reg Left Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Left if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo m3: reg Left Bologna $controls $FE if University==1 & short==1 & Immigrant==0, vce(cluster Country)
	quietly: sum Left if short==1 & University==1  & Immigrant==0
	estadd scalar ymean = r(mean)  

quietly eststo m4: reg Left Bologna $controls $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Left if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)
	
quietly eststo m7: reg Left Bologna $controls $FE if University==1 , vce(cluster Country)
	quietly: sum Left if  University==1
	estadd scalar ymean = r(mean)
	
	replace Bologna=Bologna_g
 quietly eststo m8: reg Left Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Left if short==1 & University==1
	estadd scalar ymean = r(mean)
	replace Bologna=replaceBologna
	
 
quietly eststo m10: reg Left Bologna c.Bologna#c.University University $controls $FE if short==1, vce(cluster Country)  
	quietly: sum Left  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	noisily esttab m1 m2 m3 m4  m7 m8  m10 using "T18.tex",  nolz drop(*cons *year *trend *yrbrn  *Country Female Immigrant)  booktabs label  b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) mtitles("\shortstack{Baseline  \\ \textcolor{white}{tentenna}}" "\shortstack{Main  \\ \textcolor{white}{tentenna}}" "\shortstack{Exclude  \\ immigrants}" "\shortstack{Exclude  \\  jump}"   "\shortstack{Long  \\ bwidths}" "\shortstack{Gradual \\ reform}"  "\shortstack{Triple \\ DiD}")  mgroups("\shortstack{\textbf{\normalsize OLS}\vspace*{.1cm}}" "\shortstack{\textbf{\normalsize Staggered DiD (TWFE)}\vspace*{.1cm}}", pattern(0  1  0 0 0 0 0   ) prefix(\multicolumn{@span}{c}{) suffix(})  span erepeat(\cmidrule(lr){@span}))  stats(ymean r2   N, fmt(3 3  %9.0fc) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. Obs"')) nonotes  noobs nonumbers  noeqlines coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Grad" University "Graduate")  ///
	 prehead("\begin{table}[htbp]\centering \footnotesize \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}   \caption{\scshape Additional: Voting behaviour in Section 5 \label{Voting}}  \begin{center}   \begin{threeparttable}   \begin{tabular}{l  ccccccc} \toprule" )  ///
	 prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-8}" ) ///
	 posthead("\midrule \\[-2ex] \\\\[-5ex] \multicolumn{8}{l}{\hspace{2cm} \textbf{A}:  \footnotesize {\textbf{Left-wing}: \textit{Voted left-wing parties in last election}}}\\\\[-0.5ex]") ///
	 fragment ///
	 replace ///
	 
 
quietly: reg Green Bologna  $controls $FE  if University==1, vce(cluster Country)
gen sample_e=e(sample)

quietly eststo e1: reg Green Bologna   if University==1 & short==1 & sample_e==1, vce(cluster Country)
	quietly: sum Green if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e2: reg Green Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Green if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e3: reg Green Bologna $controls $FE if University==1 & short==1 & Immigrant==0, vce(cluster Country)
	quietly: sum Green if short==1 & University==1  & Immigrant==0
	estadd scalar ymean = r(mean)  

quietly eststo e4: reg Green Bologna $controls $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Green if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)
	
quietly eststo e7: reg Green Bologna $controls $FE if University==1 , vce(cluster Country)
	quietly: sum Green if  University==1
	estadd scalar ymean = r(mean)
	
	 replace Bologna=Bologna_g
 quietly eststo e8: reg Green Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	 quietly: sum Green if short==1 & University==1
	 estadd scalar ymean = r(mean)
	 replace Bologna=replaceBologna
	
quietly eststo e10: reg Green Bologna c.Bologna#c.University University $controls $FE if short==1, vce(cluster Country)  
	quietly: sum Green  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	 noisily esttab  e1 e2 e3 e4  e7 e8  e10 using "T18.tex", nolz drop(*cons *year *trend *yrbrn *Country Female Immigrant)  booktabs label  b(3) se(3)  star(* 0.10 ** 0.05 *** 0.01) nomtitles nonumbers stats(ymean  r2  N  , fmt(3 3  %9.0fc ) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. obs"'     ))  coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Grad" University "Graduate") ///
	posthead("\hline \\[-1ex]   \multicolumn{8}{l}{\hspace{2cm}   \textbf{B}:  \footnotesize {\textbf{Green}: \textit{Voted green parties in last election}}} \\\\[-0.1ex]") ///
    prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-8}" ) ///
	fragment  ///
	append 

drop sample_e

quietly: reg Center Bologna  $controls $FE  if University==1, vce(cluster Country)
gen sample_e=e(sample)

quietly eststo e1: reg Center Bologna   if University==1 & short==1 & sample_e==1, vce(cluster Country)
	quietly: sum Center if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e2: reg Center Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Center if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e3: reg Center Bologna $controls $FE if University==1 & short==1 & Immigrant==0, vce(cluster Country)
	quietly: sum Center if short==1 & University==1  & Immigrant==0
	estadd scalar ymean = r(mean)  

quietly eststo e4: reg Center Bologna $controls $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Center if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)
	
quietly eststo e7: reg Center Bologna $controls $FE if University==1 , vce(cluster Country)
	quietly: sum Center if  University==1
	estadd scalar ymean = r(mean)
	
	 replace Bologna=Bologna_g
 quietly eststo e8: reg Center Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	 quietly: sum Center if short==1 & University==1
	 estadd scalar ymean = r(mean)
	 replace Bologna=replaceBologna
	

quietly eststo e10: reg Center Bologna c.Bologna#c.University University $controls $FE if short==1, vce(cluster Country)  
	quietly: sum Center  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	
		 noisily esttab  e1 e2 e3 e4   e7 e8  e10 using "T18.tex", nolz  drop(*cons *year *trend *yrbrn *Country Female Immigrant)  booktabs label  b(3) se(3)  star(* 0.10 ** 0.05 *** 0.01) nomtitles nonumbers stats(ymean  r2  N  , fmt(3 3  %9.0fc ) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. obs"'     ))  coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Grad" University "Graduate") ///
	posthead("\hline \\[-1ex]   \multicolumn{8}{l}{\hspace{2cm}   \textbf{C}:  \footnotesize {\textbf{Center}: \textit{Voting center parties}}} \\\\[-0.1ex]") ///
     prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-8}" ) ///
	fragment  ///
	append 

	 

	drop sample_e
 
	
quietly: reg Right Bologna  $controls $FE  if University==1, vce(cluster Country)
gen sample_e=e(sample)

quietly eststo e1: reg Right Bologna   if University==1 & short==1 & sample_e==1, vce(cluster Country)
	quietly: sum Right if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e2: reg Right Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Right if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e3: reg Right Bologna $controls $FE if University==1 & short==1 & Immigrant==0, vce(cluster Country)
	quietly: sum Right if short==1 & University==1  & Immigrant==0
	estadd scalar ymean = r(mean)  

quietly eststo e4: reg Right Bologna $controls $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Right if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)

quietly eststo e7: reg Right Bologna $controls $FE if University==1 , vce(cluster Country)
	quietly: sum Right if  University==1
	estadd scalar ymean = r(mean)
	
	 replace Bologna=Bologna_g
 quietly eststo e8: reg Right Bologna $controls $FE if University==1 & short==1, vce(cluster Country)
	 quietly: sum Right if short==1 & University==1
	 estadd scalar ymean = r(mean)
	 replace Bologna=replaceBologna
	
 
quietly eststo e10: reg Right Bologna c.Bologna#c.University University $controls $FE if short==1, vce(cluster Country)  
	quietly: sum Right  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	 noisily esttab  e1 e2 e3 e4  e7 e8  e10 using "T18.tex", nolz  drop(*cons *year *trend *yrbrn * *Country Female Immigrant)  booktabs label  b(3) se(3)  star(* 0.10 ** 0.05 *** 0.01) nomtitles nonumbers stats(ymean  r2  N  , fmt(3 3  %9.0fc ) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. obs"'     ))  coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Grad" University "Graduate") ///
	posthead("\hline \\[-1ex]   \multicolumn{8}{l}{\hspace{2cm}   \textbf{D}:  \footnotesize {\textbf{Right-wing}: \textit{Voted right-wing parties in last election}}} \\\\[-0.1ex]") ///
	prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-8}") ///
  	postfoot("\toprule  \multicolumn{8}{l}{\hspace{2cm}  \small \scshape Common modelling assumptions}\\\\[-1ex] " ///
    "SES Controls &  no  &  yes  & yes &   yes  &     yes &   yes  &   yes    \\" ///
	"Cohorts &  78-92  &      72-98  &   78-92 &   78-92 &   78-92 &     78-92  &     78-92\\" ///
	"Country FE  &  no  &    yes  &   yes &   yes &   yes &   yes  &   yes \\" ///
    "Cohort FE  &  no  &    yes  &   yes &   yes  &   yes &   yes  &   yes   \\  \toprule \end{tabular}  \begin{tablenotes} \setlength\labelsep{0pt}  \item \scriptsize {\textit{Notes.} Standard errors in parentheses. \sym{*} \(p<0.1\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\). See Table 1 in the paper.}  \end{tablenotes}   \end{threeparttable}   \end{center}  \end{table}" ) ///
	fragment ///
	append  	
	